package com.zygame.sdk.view;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import com.zygame.sdk.bean.PayResult;
import com.zygame.sdk.interfaces.InitResult;
import com.zygame.sdk.interfaces.ZySDKListener;
import com.zygame.sdk.model.UserModel;
import com.zygame.sdk.utils.SharedPreferencesHelper;
import com.zygame.sdk.utils.log.LogHelper;


/**
 * Created by Administrator on 2017/9/27.
 */

public class SplashActivity extends Activity  {

    private Context context;
    private String token;
    private static final String GetMenu = "get_menu";
    private static final String GameVersion = "gameversion";
//    private GameReceiver gameReceiver;
    private boolean menuFlag = false;
    private boolean versionFlag = false;
    private SharedPreferencesHelper spHelper;
    private ProgressDialog progressDialog;
    private ProgressDialog progressDialog1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        context = this;
        LogHelper.i("mainA","SpAct");
        setContentView(getResources().getIdentifier("zy_splash", "layout", getPackageName()));
//        ZyGameSDK.getInstance().splashInit(this, cmsdkListener); // 必须， 初始化接口

    }
    ZySDKListener cmsdkListener = new ZySDKListener() {

        @Override
        public void onInitResult(InitResult result) {
                startGameActivity();
        }

        @Override
        public void onLoginResult(UserModel userModel) {
        }

        @Override
        public void onUpData(InitResult result) {
        }


        @Override
        public void onLogout() {
        }

        @Override
        public void onPayResult(PayResult result) {

        }
    };
    private void startGameActivity() {
        try {
            LogHelper.i("mainA",",mainAct");
            Intent intent = new Intent();
            intent.setAction(getPackageName()+".sec");
            intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(intent);
            finish();
            return;
        } catch (Exception e) {
            e.printStackTrace();
        }
    }



}
